﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace parkMonitor.view.util {
	/// <summary>Show/Hide Binding</summary>
	public class ShowBind : Binding {
		public ShowBind() {
			Converter = ShowCvt.ins;
		}

		public ShowBind(string path) : base(path) {
			Converter = ShowCvt.ins;
		}
	}

	/// <summary>Show/Hide Converter</summary>
	public class ShowCvt : IValueConverter {
		public static ShowCvt ins = new ShowCvt();

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
			bool? isShow = value as bool?;
			if(isShow == true) {
				return Visibility.Visible;
			} else {
				return Visibility.Collapsed;
			}
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
			throw new NotImplementedException();
		}
	}
}
